/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package izsla.sb;

import izsla.entities.Image;
import izsla.entities.Participate;
import izsla.entities.SearchCriteria;
import izsla.entities.Trip;
import izsla.entities.TripUser;
import java.util.List;
import javax.ejb.Local;

/**
 *
 * @author aki
 */
@Local
public interface TripManagementLocal {
    public List<Trip> getTrips(SearchCriteria sc);

	/**
	 * Add a new trip to the persistance context.
	 * @param trip
	 */
    public void addTrip(Trip trip);

	/**
	 * Remove the participation entry from the database.
	 * @param part
	 */
	public void deleteTrip(Trip trip);

	 /**
	 * Returns the trip, with the given id.
	 * @param id
	 * @return the trip, or null if it is not found.
	 */
    public Trip getTrip(long id);

	/**
	 * Save the changes made to the trip.
	 * @param trip
	 */
	public void mergeTrip(Trip trip);


	public void refreshTrip(Trip trip);

	/**
	 * Delete the news with the given id.
	 * @param id
	 */
    public void deleteNews(long id);

	/**
	 * Find out, if the user is participating in the given trip.
	 * @param user
	 * @param trip
	 * @return
	 */
	public boolean isParticipate(TripUser user, Trip trip);

	/**
	 * Remove the participation entry from the database.
	 * @param part
	 */
	public void deleteParticipation(Participate part);

	/**
	 * Create a new image.
	 * @param trip
	 * @param user the uploader of the image.
	 * @return
	 */
	public Image createImage(Trip trip, TripUser user);

	/**
	 * Persist the changes of the image.
	 * @param image
	 */
	public void saveImage(Image image);


	/**
	 * Get image by id.
	 * @param id
	 * @return the image, or null if it is not found
	 */
	public Image getImage(long id);
}
